import matplotlib.pyplot as plt
import pandas as pd
import numpy as np

# 加载数据
df = pd.read_csv('plot/counts_1_test_hist.csv')  # 更新文件路径

# 创建图形和子图
num_models = len(df.columns)
fig, axes = plt.subplots(nrows=1, ncols=num_models, figsize=(num_models * 5, 4), sharey=True)

# 遍历每个模型，为每个模型绘制一个直方图
for ax, (model_name, model_data) in zip(axes, df.iteritems()):
    ax.bar(df.index, model_data, color='skyblue')
    ax.set_title(model_name)
    ax.set_xlabel('Metrics')
    ax.set_xticks(df.index)
    ax.set_xticklabels(df.index, rotation=45)
    ax.set_ylabel('Performance')

# 调整布局以防止标签重叠
plt.tight_layout()

# 显示图形
plt.show()
